package com.yy.wga.common.web.intereceptor;

import com.yy.wga.common.core.dto.BaseReqDTO;

/**
 * @Author: gc
 * @Date: 2024/10/22
 * @Description:
 **/
public class RequestHolder {
    /**
     * 公共信息
     */
    private final static ThreadLocal<BaseReqDTO> BASE_REQUEST_THREADLOCAL = new ThreadLocal<>();

    public static BaseReqDTO getBaseRequest() {
        return BASE_REQUEST_THREADLOCAL.get();
    }

    public static void setBaseRequest(BaseReqDTO baseRequest) {
        BASE_REQUEST_THREADLOCAL.set(baseRequest);
    }

    public static void removeBaseRequest() {
        BASE_REQUEST_THREADLOCAL.remove();
    }

    public static String getAppKey() {
        BaseReqDTO baseRequest = getBaseRequest();
        return baseRequest.getAppKey();
    }
}
